#include "stdio.h"
#include "stdlib.h"
#include "unistd.h"
#include "sys/ioctl.h"
#include "linux/input.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


int main(void)
{
	int fd;
	struct input_event ev;

	fd = open("/dev/event0", O_RDONLY);
	if(fd<0){
		return -1;
	}

#if 1
	while(1){
		read(fd, &ev, sizeof(struct input_event));

		if(ev.type == EV_KEY){
			printf("[APP] code=%x, type=%x, val = %x\n", ev.code, ev.type, ev.value);
		}
		else if(ev.type == EV_SYN){
			printf("[APP] EV_SYN ...\n");
		}
	}

#else
	while(1){
		if(read(fd, &ev, sizeof(struct input_event))>0){
			printf("[APP] code=%x, type=%x, val = %x\n", ev.code, ev.type, ev.value);
		}
	}
#endif	

	close(fd);
	
	return 0;
}




